package com.hualan.web;

import com.hualan.pojo.Consultants;
import com.hualan.service.service.service.ConsultantsService;
import com.hualan.util.ResultEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/consultants")
public class ConsultantsController {
    @Autowired
    private ConsultantsService consultantsService;
    @RequestMapping("/listAll")
    public ResultEntity listAll(){
        System.out.println(consultantsService.listAll());
        return ResultEntity.ok(consultantsService.listAll());
    }
    @RequestMapping("/findById2")
    public ResultEntity findById2(Integer tid){
        return ResultEntity.ok(consultantsService.findById2(tid));
    }

    @RequestMapping("/findAll")
    public ResultEntity findAll(Integer tid){
        return ResultEntity.ok(consultantsService.findAll(tid));
    }

    @RequestMapping("/listAllShoufei")
    public ResultEntity listAllShoufei(Integer tid){
        return ResultEntity.ok(consultantsService.listAllShoufei(tid));
    }


    @RequestMapping("/listAllHuifu")
    public ResultEntity listAllHuifu(Integer tid){
        return ResultEntity.ok(consultantsService.listAllHuifu(tid));
    }

    @RequestMapping("/findByIdUserpinglun")
    public ResultEntity findByIdUserpinglun(Integer tid){
        return ResultEntity.ok(consultantsService.findByIdUserpinglun(tid));
    }

    @RequestMapping("/findByIdFabukecheng")
    public ResultEntity findByIdFabukecheng(Integer tid){
        return ResultEntity.ok(consultantsService.findByIdFabukecheng(tid));
    }



    // 添加模糊查询接口
    @RequestMapping("/search")
    public ResultEntity searchConsultants(String keyword) {
        List<Consultants> consultants = consultantsService.searchConsultants(keyword);
        return ResultEntity.ok(consultants);
    }
}
